{% extends 'stocks/base.html' %}

{% block title %}{{ title }}{% endblock %}

{% block content %}
<div class="container-fluid">
    <div class="row mb-4">
        <div class="col-12">
            <nav aria-label="breadcrumb">
                <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a href="{% url 'strategy_dashboard' %}">策略仪表板</a></li>
                    <li class="breadcrumb-item"><a href="{% url 'stock_list' %}">股票列表</a></li>
                    <li class="breadcrumb-item active">{{ stock.symbol }} - 策略分析</li>
                </ol>
            </nav>
            <h2>{{ stock.symbol }} - {{ stock.name }}</h2>
            <p class="text-muted">使用交易策略分析该股票</p>
        </div>
    </div>

    <div class="row">
        <div class="col-md-6">
            <div class="card">
                <div class="card-header">
                    <h5 class="card-title mb-0">策略分析</h5>
                </div>
                <div class="card-body">
                    <form method="post">
                        {% csrf_token %}
                        <div class="mb-3">
                            <label class="form-label">选择分析策略</label>
                            <div>
                                {% if request.GET.strategy_id %}
                                    <input type="hidden" name="strategy_id" value="{{ request.GET.strategy_id }}">
                                    <span class="badge bg-primary">使用特定策略分析</span>
                                {% else %}
                                    <div class="form-text">将使用所有已启用的策略进行分析</div>
                                {% endif %}
                            </div>
                        </div>
                        
                        <button type="submit" class="btn btn-primary w-100">
                            <i class="fas fa-cogs"></i> 开始分析
                        </button>
                    </form>
                </div>
            </div>
        </div>

        <div class="col-md-6">
            <div class="card">
                <div class="card-header">
                    <h5 class="card-title mb-0">分析说明</h5>
                </div>
                <div class="card-body">
                    <div class="alert alert-info">
                        <h6><i class="fas fa-info-circle"></i> 分析过程说明</h6>
                        <ul class="mb-0">
                            <li>将对股票执行所有已启用的交易策略分析</li>
                            <li>分析结果将显示发现的买入信号</li>
                            <li>符合条件的信号将自动保存到数据库</li>
                            <li>可以在"买入信号"页面查看所有信号</li>
                        </ul>
                    </div>
                    
                    <div class="alert alert-warning">
                        <h6><i class="fas fa-exclamation-triangle"></i> 注意事项</h6>
                        <ul class="mb-0">
                            <li>分析需要股票的日线数据</li>
                            <li>信号强度基于技术指标计算</li>
                            <li>分析结果仅供参考，投资需谨慎</li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>

    {% if messages %}
    <div class="row mt-4">
        <div class="col-12">
            <div class="alert alert-info">
                {% for message in messages %}
                    <p>{{ message }}</p>
                {% endfor %}
            </div>
        </div>
    </div>
    {% endif %}
</div>
{% endblock %}
